//
//  GS_HeroTopViewController.m
//  GoodManNews
//
//  Created by dllo on 16/1/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "GS_HeroTopViewController.h"
#import "GS_HeroTopTableViewCell.h"
#import <Masonry.h>
#import "GoodManNews_AFNetTool.h"
#import "GS_HeroTopModel.h"
#import <MBProgressHUD.h>
#import "YSY_HeroDetail_ViewController.h"
#import "YSY_HeroArr.h"
#import "YSY_Game_heroModel.h"

@interface GS_HeroTopViewController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, retain) UITableView *tableV;
@property (nonatomic, retain) UIButton *firstBut;
@property (nonatomic, retain) NSMutableArray *heroTopArr;
@property (nonatomic, retain) UIButton *secondBut;
@property (nonatomic, retain) UIView *hiddenView;
@property (nonatomic, assign) NSInteger num;
@property (nonatomic, retain) UIButton *appearBut;
@property (nonatomic, retain) UIButton *winBut;
@property (nonatomic, retain) UIButton *KDABut;
@property (nonatomic, retain) UIButton *pentaKillBut;
@property (nonatomic, retain) UIButton *prohibitBut;
@property (nonatomic, retain) UIView *hiddenSecondV;
@property (nonatomic, retain) UIButton *allBut;
@property (nonatomic, retain) UIButton *topBut;
@property (nonatomic, retain) UIButton *APBut;
@property (nonatomic, retain) UIButton *ADCBut;
@property (nonatomic, retain) UIButton *supportBut;
@property (nonatomic, retain) UIButton *jungleBut;
@property (nonatomic, retain) GS_HeroTopTableViewCell *cell;

//两个总分类
@property (nonatomic, assign) NSInteger condition;
@property (nonatomic, assign) NSInteger position;


//两个下拉按钮的标题
@property (nonatomic, copy) NSString *firstStr;
@property (nonatomic, copy) NSString *secondStr;


@property (nonatomic, retain) MBProgressHUD *hud;
//两个排行分类
@property (nonatomic, copy) NSString *topStr;
@property (nonatomic, copy) NSString *bottomStr;

@end

@implementation GS_HeroTopViewController

- (void)dealloc
{
    self.tableV.delegate = nil;
    self.tableV.dataSource = nil;
    [_tableV release];
    [_hiddenView release];
    [_hiddenSecondV release];
    [_heroTopArr release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //菊花转转转
    self.hud = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
    [self.navigationController.view addSubview:self.hud];
    self.hud.labelText = @"Loading";
    [self.hud show:YES];
    self.view.backgroundColor = [UIColor yellowColor];
    self.navigationItem.title = @"英雄榜";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"GS_return"] style:UIBarButtonItemStylePlain target:self action:@selector(leftAction)];
    self.condition = 0;
    self.position = 0;
    [self createTableView];
    [self getData];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.hidesBottomBarWhenPushed = YES;
    }
    return self;
}

- (void)createTableView
{
    self.num = 1;
    self.firstStr = @"登场率";
    self.topStr = @"登场率:";
    self.bottomStr = @"胜场:";
    self.firstBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.firstBut.frame = CGRectMake(0, 0, self.view.frame.size.width / 2, 30);
    self.firstBut.backgroundColor = [UIColor blackColor];
    [self.firstBut setTitle:@"登场率v" forState:UIControlStateNormal];
    self.firstBut.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.firstBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.firstBut addTarget:self action:@selector(firstButAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.firstBut];
    
    self.secondStr = @"全部";
    self.secondBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.secondBut.frame = CGRectMake(self.view.frame.size.width / 2, 0, self.view.frame.size.width / 2, 30);
    self.secondBut.backgroundColor = [UIColor blackColor];
    [self.secondBut setTitle:@"全部v" forState:UIControlStateNormal];
    self.secondBut.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.secondBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.secondBut addTarget:self action:@selector(secondButAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.secondBut];
    
    
    self.tableV = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    [self.view addSubview:self.tableV];
    self.tableV.delegate = self;
    self.tableV.dataSource = self;
    [_tableV release];
    
    [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.firstBut.mas_bottom);
        make.width.mas_equalTo(self.view);
        make.height.mas_equalTo( self.view.bounds.size.height - 94);
//        make.edges.equalTo(self.view);
        
    }];
    
    self.hiddenView = [UIView new];
    self.hiddenView.backgroundColor = [UIColor blackColor];
    self.hiddenView.alpha = 0.5;
    [self.view addSubview:self.hiddenView];
    
    [self.hiddenView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.firstBut.mas_bottom).with.offset(0);
        make.left.equalTo(self.view);
        make.width.mas_equalTo(self.view);
        make.height.mas_equalTo(@30);
        
    }];
    
    self.hiddenSecondV = [UIView new];
    self.hiddenSecondV.backgroundColor = [UIColor blackColor];
    self.hiddenSecondV.alpha = 0.5;
    [self.view addSubview:self.hiddenSecondV];
    
    [self.hiddenSecondV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.firstBut.mas_bottom).with.offset(0);
        make.left.equalTo(self.view);
        make.width.mas_equalTo(self.view);
        make.height.mas_equalTo(@30);
        
    }];
    
    self.hiddenView.hidden = YES;
    self.hiddenSecondV.hidden = YES;
    
    self.appearBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.appearBut.frame = CGRectMake(0, 0, self.view.frame.size.width / 5, 30);
    self.appearBut.backgroundColor = [UIColor blackColor];
    [self.appearBut setTitle:@"登场率" forState:UIControlStateNormal];
     self.appearBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.appearBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.appearBut addTarget:self action:@selector(appearButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenView addSubview:self.appearBut];
    
    self.winBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.winBut.frame = CGRectMake(self.view.frame.size.width / 5, 0, self.view.frame.size.width / 5, 30);
    self.winBut.backgroundColor = [UIColor blackColor];
    [self.winBut setTitle:@"胜场" forState:UIControlStateNormal];
    self.winBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.winBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.winBut addTarget:self action:@selector(winButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenView addSubview:self.winBut];
    
    self.KDABut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.KDABut.frame = CGRectMake(self.view.frame.size.width / 5 * 2, 0, self.view.frame.size.width / 5, 30);
    self.KDABut.backgroundColor = [UIColor blackColor];
    [self.KDABut setTitle:@"KDA" forState:UIControlStateNormal];
    self.KDABut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.KDABut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.KDABut addTarget:self action:@selector(KDAButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenView addSubview:self.KDABut];
    
    self.pentaKillBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.pentaKillBut.frame = CGRectMake(self.view.frame.size.width / 5 * 3, 0, self.view.frame.size.width / 5, 30);
    self.pentaKillBut.backgroundColor = [UIColor blackColor];
    [self.pentaKillBut setTitle:@"5杀" forState:UIControlStateNormal];
    self.pentaKillBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.pentaKillBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.pentaKillBut addTarget:self action:@selector(pentaKillButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenView addSubview:self.pentaKillBut];
    
    self.prohibitBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.prohibitBut.frame = CGRectMake(self.view.frame.size.width / 5 * 4, 0, self.view.frame.size.width / 5, 30);
    self.prohibitBut.backgroundColor = [UIColor blackColor];
    [self.prohibitBut setTitle:@"被禁率" forState:UIControlStateNormal];
    self.prohibitBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.prohibitBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.prohibitBut addTarget:self action:@selector(prohibitButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenView addSubview:self.prohibitBut];
    
    self.allBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.allBut.frame = CGRectMake(0, 0, self.view.frame.size.width / 6, 30);
    self.allBut.backgroundColor = [UIColor blackColor];
    [self.allBut setTitle:@"全部" forState:UIControlStateNormal];
    self.allBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.allBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.allBut addTarget:self action:@selector(allButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenSecondV addSubview:self.allBut];
    
    self.topBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.topBut.frame = CGRectMake(self.view.frame.size.width / 6, 0, self.view.frame.size.width / 6, 30);
    self.topBut.backgroundColor = [UIColor blackColor];
    [self.topBut setTitle:@"上单" forState:UIControlStateNormal];
    self.topBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.topBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.topBut addTarget:self action:@selector(topButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenSecondV addSubview:self.topBut];
    
    self.APBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.APBut.frame = CGRectMake(self.view.frame.size.width / 6 * 2, 0, self.view.frame.size.width / 6, 30);
    self.APBut.backgroundColor = [UIColor blackColor];
    [self.APBut setTitle:@"中单" forState:UIControlStateNormal];
    self.APBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.APBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.APBut addTarget:self action:@selector(APButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenSecondV addSubview:self.APBut];
    
    self.ADCBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.ADCBut.frame = CGRectMake(self.view.frame.size.width / 6 * 3, 0, self.view.frame.size.width / 6, 30);
    self.ADCBut.backgroundColor = [UIColor blackColor];
    [self.ADCBut setTitle:@"ADC" forState:UIControlStateNormal];
    self.ADCBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.ADCBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.ADCBut addTarget:self action:@selector(ADCButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenSecondV addSubview:self.ADCBut];
    
    self.supportBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.supportBut.frame = CGRectMake(self.view.frame.size.width / 6 * 4, 0, self.view.frame.size.width / 6, 30);
    self.supportBut.backgroundColor = [UIColor blackColor];
    [self.supportBut setTitle:@"辅助" forState:UIControlStateNormal];
    self.supportBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.supportBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.supportBut addTarget:self action:@selector(supportButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenSecondV addSubview:self.supportBut];
    
    self.jungleBut = [UIButton buttonWithType:UIButtonTypeCustom];
    self.jungleBut.frame = CGRectMake(self.view.frame.size.width / 6 * 5, 0, self.view.frame.size.width / 6, 30);
    self.jungleBut.backgroundColor = [UIColor blackColor];
    [self.jungleBut setTitle:@"打野" forState:UIControlStateNormal];
    self.jungleBut.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.jungleBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.jungleBut addTarget:self action:@selector(jungleButAction) forControlEvents:UIControlEventTouchUpInside];
    [self.hiddenSecondV addSubview:self.jungleBut];
    
}

- (void)leftAction

{
    [self.navigationController popToRootViewControllerAnimated:YES];
    
}

- (void)winButAction
{
    [self.hud show:YES];
    self.condition = 1;
    self.firstStr = @"胜场";
    self.topStr = @"登场率:";
    self.bottomStr = @"胜场:";
    [self.firstBut setTitle:@"胜场^" forState:UIControlStateNormal];
    [self getData];
}

- (void)appearButAction
{
    [self.hud show:YES];
    self.condition = 0;
    self.firstStr = @"登场率";
    self.topStr = @"登场率:";
    self.bottomStr = @"胜场:";
    [self.firstBut setTitle:@"登场率^" forState:UIControlStateNormal];
    [self getData];
}

- (void)KDAButAction
{
    [self.hud show:YES];
    self.condition = 2;
    self.firstStr = @"KDA";
    self.topStr = @"KDA:";
    self.bottomStr = @"五 杀:";
    [self.firstBut setTitle:@"KDA^" forState:UIControlStateNormal];
    [self getData];
    
}

- (void)pentaKillButAction
{
    [self.hud show:YES];
    self.condition = 3;
    self.firstStr = @"五 杀";
    self.topStr = @"KDA:";
    self.bottomStr = @"五 杀:";
    [self.firstBut setTitle:@"五 杀^" forState:UIControlStateNormal];
    [self getData];
    
}

- (void)prohibitButAction
{
    [self.hud show:YES];
    self.condition = 4;
    self.firstStr = @"被禁率";
    self.topStr = @"被禁率:";
    [self.firstBut setTitle:@"被禁率^" forState:UIControlStateNormal];
    [self getData];
    
}

- (void)allButAction
{
    [self.hud show:YES];
    self.position = 0;
    self.secondStr = @"全部";
    [self.secondBut setTitle:@"全部^" forState:UIControlStateNormal];
    [self getData];
    
}

- (void)topButAction
{
    [self.hud show:YES];
    self.position = 1;
    self.secondStr = @"上单";
    [self.secondBut setTitle:@"上单^" forState:UIControlStateNormal];
    [self getData];
}

- (void)APButAction
{
    [self.hud show:YES];
    self.position = 2;
    self.secondStr = @"中单";
    [self.secondBut setTitle:@"中单^" forState:UIControlStateNormal];
    [self getData];
}

 - (void)ADCButAction
{
    [self.hud show:YES];
    self.position = 3;
    self.secondStr = @"ADC";
    [self.secondBut setTitle:@"ADC^" forState:UIControlStateNormal];
    [self getData];
}

- (void)supportButAction
{
    [self.hud show:YES];
    self.position = 4;
    self.secondStr = @"辅助";
    [self.secondBut setTitle:@"辅助^" forState:UIControlStateNormal];
    [self getData];
}

- (void)jungleButAction
{
    [self.hud show:YES];
    self.position = 5;
    self.secondStr = @"打野";
    [self.secondBut setTitle:@"打野^      " forState:UIControlStateNormal];
    [self getData];
    
}

- (void)firstButAction:(UIButton *)button
{
    if (YES == self.hiddenSecondV.hidden) {
        if (0 == self.num) {
            [self.firstBut setTitle:[NSString stringWithFormat:@"%@v", self.firstStr] forState:UIControlStateNormal];
            [self.firstBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            self.hiddenView.hidden = YES;
            self.num = 1;
        } else {
            self.hiddenView.hidden = NO;
            [self.firstBut setTitle:[NSString stringWithFormat:@"%@^", self.firstStr] forState:UIControlStateNormal];
            [self.firstBut setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal];
            self.num = 0;
        }
    } else {
        self.hiddenSecondV.hidden = YES;
        self.hiddenView.hidden = NO;
        [self.secondBut setTitle:[NSString stringWithFormat:@"%@v", self.secondStr] forState:UIControlStateNormal];
        [self.secondBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.firstBut setTitle:[NSString stringWithFormat:@"%@^", self.firstStr] forState:UIControlStateNormal];
        [self.firstBut setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal];
        self.num = 1;
    }
    
    
}

- (void)secondButAction:(UIButton *)button
{
    if (YES == self.hiddenView.hidden) {
        if (0 == self.num) {
            [self.secondBut setTitle:[NSString stringWithFormat:@"%@v", self.secondStr] forState:UIControlStateNormal];
            [self.secondBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            self.hiddenSecondV.hidden = YES;
            self.num = 1;
        } else {
            self.hiddenSecondV.hidden = NO;
            [self.secondBut setTitle:[NSString stringWithFormat:@"%@^", self.secondStr] forState:UIControlStateNormal];
            [self.secondBut setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal];
            self.num = 0;
        }

    } else {
        self.hiddenView.hidden = YES;
        
        [self.firstBut setTitle:[NSString stringWithFormat:@"%@v", self.firstStr] forState:UIControlStateNormal];
        [self.firstBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.secondBut setTitle:[NSString stringWithFormat:@"%@^", self.secondStr] forState:UIControlStateNormal];
        [self.secondBut setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal];
        self.hiddenSecondV.hidden = NO;
        self.num = 1;
    }
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{
    return self.heroTopArr.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 100;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{
    GS_HeroTopModel *model = self.heroTopArr[indexPath.row];
    YSY_HeroDetail_ViewController *heroVC = [[YSY_HeroDetail_ViewController alloc] init];

    NSLog(@"%@", model.name);
    NSArray *arr = [NSArray arrayWithArray: [YSY_HeroArr shareHeroArr].heroArr] ;
    NSLog(@"----%ld", [YSY_HeroArr shareHeroArr].heroArr.count);
    for (YSY_Game_HeroModel *model1 in arr) {
        if ([model1.title isEqualToString:model.name]) {
            NSLog(@"英文名字:%@", model1.enName);
            heroVC.heroEnName = model1.enName;
        }
    }
                    
   
    [self.navigationController pushViewController:heroVC animated:YES];
    [heroVC release];
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{
//    NSLog(@"condiction = %ld positoon = %ld", self.condition, self.position);
    GS_HeroTopModel *model = self.heroTopArr[indexPath.row];
    NSString *str = @"cell";
    GS_HeroTopTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
    if (nil == cell) {
        cell = [[GS_HeroTopTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:str];
    }
    if (0 == self.condition || 1 == self.condition) {
        cell.secondColorL.hidden = NO;
        cell.secondL.hidden = NO;
        cell.type = 1;
        float debut = [model.debut floatValue];
        float win = [model.win floatValue];
        cell.deb = debut;
        cell.win = win;
        cell.firstPersentL.text = [NSString stringWithFormat:@"%@%%", model.debut];
        cell.secondPersentL.text = [NSString stringWithFormat:@"%@%%", model.win];
        cell.firstColorL.backgroundColor = [UIColor blueColor];
        cell.secondColorL.backgroundColor = [UIColor greenColor];
    } else if (2 == self.condition || 3 == self.condition) {
        cell.secondColorL.hidden = NO;
        cell.secondL.hidden = NO;
        cell.type = 2;
        float kda = [model.kda floatValue];
        float five_kill = [model.five_kill floatValue];
        cell.deb = kda;
        cell.win = five_kill;
        if ([model.five_kill isEqualToString:@""]) {
            cell.secondPersentL.text = @"0.0";
        } else {
            cell.secondPersentL.text = [NSString stringWithFormat:@"%@", model.five_kill];
        }
        cell.firstPersentL.text = [NSString stringWithFormat:@"%@", model.kda];
        cell.firstColorL.backgroundColor = [UIColor purpleColor];
        cell.secondColorL.backgroundColor = [UIColor redColor];
    } else if (4 == self.condition) {
        cell.type = 3;
        float ban = [model.ban floatValue];
        cell.deb = ban;
        if ([model.ban isEqualToString:@""]) {
            cell.firstPersentL.text = @"0.0%%";
        } else {
            cell.firstPersentL.text = [NSString stringWithFormat:@"%@%%", model.ban];
        }
        cell.secondPersentL.text = nil;
        cell.firstColorL.backgroundColor = [UIColor orangeColor];
        cell.secondColorL.hidden = YES;
        cell.secondL.hidden = YES;
    }
    cell.numL.text = [NSString stringWithFormat:@"%ld", indexPath.row + 1];
    [cell.imageV sd_setImageWithURL:[NSURL URLWithString:model.url] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    cell.backgroundColor = [UIColor grayColor];
    cell.nameL.text = model.name;
    cell.secondL.text = self.bottomStr;
    cell.firstL.text = self.topStr;
    
    return cell;
}




- (void)getData
{
    self.heroTopArr = [NSMutableArray array];
    NSString *str = [NSString stringWithFormat:@"http://api.lol.zhangyoubao.com/apis/rest//RolesService/heroRanks?condition=%@&page=1&position=%@&i_=352324075088508&t_=1452741941798&p_=7739&v_=400704&a_=lol&pkg_=com.anzogame.lol", [NSString stringWithFormat:@"%ld", self.condition], [NSString stringWithFormat:@"%ld", self.position]];
    [GoodManNews_AFNetTool getNetWithURL:str body:nil headFile:nil responseStyle:WBNJSON success:^(NSURLSessionDataTask *task, id responseObject) {
        
//        NSLog(@"%@", responseObject);
        NSMutableArray *dataArr = [responseObject objectForKey:@"data"];
        for (NSMutableDictionary *dic in dataArr) {
            GS_HeroTopModel *model = [[GS_HeroTopModel alloc] initWithDic:dic];
            [self.heroTopArr addObject:model];
        }
//        NSLog(@"%@", self.heroTopArr);
        
        [self.tableV reloadData];
        [self.hud hide:YES];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
        
    }];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
